package com.liu.SocketTcp;
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
public class client {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket(InetAddress.getLocalHost(), 7777);
        String filePhat = "D:\\CloudMusic\\dl.png";
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream(filePhat));
        //照片对应的字节
        byte[] bytes = StreamUtils.streamToByteArray(bis);
        BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream());
        bos.write(bytes);
        socket.shutdownOutput();


        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String s = bufferedReader.readLine();
        System.out.println(s);

        bos.close();
        bis.close();
        bufferedReader.close();
        socket.close();
    }
}
